using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_ShopIdentifyUser : Admin, IRequiresSessionState
{
	private int m_userID = 0;
	private int m_type = 0;
	protected HyperLink CompanyIdentify;
	protected Literal UserIdentifyTitle;
	protected Literal TxtUserName;
	protected Label lblTrueName;
	protected Label lblHomePhone;
	protected Label lblMobilePhone;
	protected Label lblIDCardNum;
	protected HiddenField H_IDPhotoUrl;
	protected Image IDPhoto;
	protected HiddenField hfIDCardImgBack;
	protected Image imgIDCardImgBack;
	protected RadioButtonList Status;
	protected TextBox Remark;
	protected Literal Checker;
	protected Label err_tips;
	protected Button SaveInfo;
	protected HiddenField H_IdentifyID;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(5))
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "Identify");
			base.WriteRightErrMsg();
		}
		if (!base.admin.CheckAdminPower(5))
		{
			this.Status.Enabled = false;
		}
		this.m_userID = Fetch.GetID("userid");
		this.m_type = Fetch.GetID("type");
		if (this.m_userID == 0 || this.m_type == 0)
		{
			this.WriteErrMsg("", Language.GetAdminMsg("Common/ParamErr"), "");
		}
		if (!base.IsPostBack)
		{
			this.Checker.Text = base.admin.AdminName;
			this.InitPage();
		}
	}
	protected void InitPage()
	{
		this.CompanyIdentify.NavigateUrl = "Admin_Application.aspx?type=2&userid=" + Fetch.GetID("userid");
		Shop_Application shop_Application = new Shop_Application(this.conn);
		DataTable applicationByUserIDType = shop_Application.GetApplicationByUserIDType(this.m_userID, this.m_type);
		if (applicationByUserIDType.Rows.Count >= 1)
		{
			this.UserIdentifyTitle.Text = "审核用户身份认证的申请信息";
			string[] contentArray = applicationByUserIDType.Rows[0]["IdentifyDetail"].ToString().Split(new char[]
			{
				'$'
			});
			this.H_IdentifyID.Value = applicationByUserIDType.Rows[0]["IdentifyID"].ToString();
			this.TxtUserName.Text = applicationByUserIDType.Rows[0]["UserName"].ToString();
			this.lblTrueName.Text = Shop_Application.GetContentByName("TrueName", contentArray);
			this.lblIDCardNum.Text = Shop_Application.GetContentByName("IDCardNum", contentArray);
			this.lblHomePhone.Text = Shop_Application.GetContentByName("HomePhone", contentArray);
			this.lblMobilePhone.Text = Shop_Application.GetContentByName("Mobile", contentArray);
			if (!string.IsNullOrEmpty(applicationByUserIDType.Rows[0]["Editor"].ToString()))
			{
				this.Checker.Text = applicationByUserIDType.Rows[0]["Editor"].ToString();
			}
			string a = applicationByUserIDType.Rows[0]["Status"].ToString().ToLower().Trim();
			if (a == "1")
			{
				this.Status.Items[0].Selected = true;
			}
			else
			{
				this.Status.Items[1].Selected = true;
			}
			this.Remark.Text = applicationByUserIDType.Rows[0]["Remark"].ToString();
			string text = Shop_Application.GetContentByName("IDCardUploadUrl", contentArray);
			if (string.IsNullOrEmpty(text))
			{
				text = "/Images/show_nopic.gif";
			}
			else
			{
				text = text.Replace('\\', '/');
			}
			this.IDPhoto.ImageUrl = text;
			string text2 = Shop_Application.GetContentByName("IDCardUploadUrlBack", contentArray);
			if (string.IsNullOrEmpty(text2))
			{
				text2 = "/Images/show_nopic.gif";
			}
			else
			{
				text2 = text2.Replace('\\', '/');
			}
			this.imgIDCardImgBack.ImageUrl = text2;
		}
		else
		{
			this.UserIdentifyTitle.Text = "设置用户身份认证";
			UserBll userBll = new UserBll(this.conn);
			this.TxtUserName.Text = userBll.GetUserNameByID(this.m_userID);
			this.IDPhoto.ImageUrl = "/Images/show_nopic.gif";
		}
	}
	protected void SaveInfo_Click(object sender, EventArgs e)
	{
		string text = this.Remark.Text;
		if (!string.IsNullOrEmpty(text))
		{
			if (this.Remark.Text.Length > 200)
			{
				this.WriteErrMsg("", Language.GetAdminMsg("Common/TooLong"), "");
			}
		}
		int status = int.Parse(this.Status.SelectedValue);
		string text2 = this.Checker.Text;
		int num = 0;
		if (this.H_IdentifyID.Value != "" && Text.IsNumber(this.H_IdentifyID.Value))
		{
			num = this.H_IdentifyID.Value.ToInt32(new int[0]);
		}
		if (num != 0)
		{
			bool flag = Shop_Application.instance.CheckUpdateApplication(this.m_userID, num, 1, text, text2, status);
			if (flag)
			{
				this.WriteSuccessMsg("", Language.GetAdminMsg("Common/EditSuccess"), "Admin_ShopUserCheck.aspx?MenuID=2&MenuName=会员&FileName=会员认证");
			}
		}
	}
}
